#
# @lc app=leetcode.cn id=190 lang=python
#
# [190] 颠倒二进制位
#

# @lc code=start
class Solution:
    # @param n, an integer
    # @return an integer
    def reverseBits(self, n):
        result = 0
        for i in range(32):
            # 将result左移一位，并加上n的最低位
            result = (result << 1) | (n & 1)
            # n右移一位
            n >>= 1
        return result
        
        
# @lc code=end

